﻿package coreFx{
	import flash.display.MovieClip;
	import flash.display.Stage;
	import flash.events.Event;
	
	public class Customer extends MovieClip{
		
		//attrib
		var moveAble:Boolean = false;
		var roadMap:Array;
		var target:String = "state0";
		
		public function Customer(){
			
			trace("Customer Engage");
			this.x = 3; this.y = 2;
			//this.moveAble = true;
			stop();
			
			roadMap = new Array();
			//****************
			var max = 10;
			var min = 1;
			var rx = Math.round(Math.random()*(max-min)+min);
			
			if(rx > 5){
				roadMap[0] = "state0";
				roadMap[1] = "state1";
			}else{
				roadMap[0] = "state1";
				roadMap[1] = "state0";
			}
			
			roadMap[2] = "state2";
			roadMap[3] = "state3";
			roadMap[4] = "state4";
			roadMap[5] = "state5";
			roadMap[6] = "stateFinish";
			this.target=roadMap.shift();
			//roadMap.slice(0,1);
			
			
		}
		
		public function walk(direction:int){
			this.gotoAndStop("walk");
			switch(direction){
				case Mild._RIGHT : this.x+=1;break;
				case Mild._LEFT : this.x-=1;break;
				case Mild._UP : this.y-=1;break;
				case Mild._DOWN : this.y+=1;break;
				}
		}
		
		public function wait(){
			//this.moveAble = false;
			this.gotoAndStop("wait");
		}
		

		public function shiftRoadMap():String{
			return roadMap.shift();
		}

		public function serve(){
			this.gotoAndStop("serve");
		}

		
		
		
	}
}